// logs.js
const util = require('../../utils/util.js')

Page({
    data: {
        logs: [],
        text1:"",
        text2:"",
        from:""
    },
    onLoad() {
        var that=this
        this.setData({
            logs: (wx.getStorageSync('logs') || []).map(log => {
                return {
                    date: util.formatTime(new Date(log)),
                    timeStamp: log
                }
            })
        })
        wx.request({
            url: 'https://v1.hitokoto.cn/?c=f&encode=text',
            method:'GET',
            success(res){
                console.log(res)
                that.setData({
                    text1:res.data
                })
            }
        })
        wx.request({
            url: 'https://v1.hitokoto.cn/',
            method:'GET',
            success(res){
                console.log(res)
                that.setData({
                    text2:res.data.hitokoto,
                    from:res.data.from
                })
            }
        })

    }

})
